libxc: Fix xc_translate_foreign_address() to parse non-pae pagetables
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 25 Apr 2007 08:49:18 +0000 (09:49 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 25 Apr 2007 08:49:18 +0000 (09:49 +0100)
correctly.
From: Chris Morrow <cmorrow@yottayotta.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/libxc/xc_pagetab.c

index 85b3d15800865f308446c418f835ceacfbb6363c..e67a34ae8f42dadb128810e62408edc34a00d980 100644 (file)
@@ -132,7 +132,7 @@ unsigned long xc_translate_foreign_address(int xc_handle, uint32_t dom,
     if (pt_levels >= 3)
         pde = *(unsigned long long *)(pd + 8 * ((virt >> L2_PAGETABLE_SHIFT_PAE) & L2_PAGETABLE_MASK_PAE));
     else
-        pde = *(unsigned long long *)(pd + 4 * ((virt >> L2_PAGETABLE_SHIFT) & L2_PAGETABLE_MASK));
+        pde = *(unsigned long *)(pd + 4 * ((virt >> L2_PAGETABLE_SHIFT) & L2_PAGETABLE_MASK));
 
     if ((pde & 1) == 0) {
         DPRINTF("page entry not present in PD\n");
@@ -156,9 +156,9 @@ unsigned long xc_translate_foreign_address(int xc_handle, uint32_t dom,
         if (pt_levels >= 3)
             pte = *(unsigned long long *)(pt + 8 * ((virt >> L1_PAGETABLE_SHIFT_PAE) & L1_PAGETABLE_MASK_PAE));
         else
-            pte = *(unsigned long long *)(pt + 4 * ((virt >> L1_PAGETABLE_SHIFT) & L1_PAGETABLE_MASK));
+            pte = *(unsigned long *)(pt + 4 * ((virt >> L1_PAGETABLE_SHIFT) & L1_PAGETABLE_MASK));
 
-        if ((pte & 0x00000001) == 0) {
+        if ((pte & 1) == 0) {
             DPRINTF("page entry not present in PT\n");
             goto out_unmap_pt;
         }